package com.example.webmodule.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.webmodule.mapper.ServiceInterfaceMapper;
import com.example.webmodule.model.ServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/web/mapper")
public class MapperController {

    private ServiceInterfaceMapper serviceInterfaceMapper;

    @Autowired
    public MapperController(ServiceInterfaceMapper serviceInterfaceMapper) {
        this.serviceInterfaceMapper = serviceInterfaceMapper;
    }
    @GetMapping("/getData")
    public List<ServiceInterface> getData() {
//        List<ServiceInterface> list = serviceInterfaceMapper.selectAll();
//        return list;
        Wrapper<ServiceInterface> wrapper = Wrappers.query();
        return serviceInterfaceMapper.selectList(wrapper);
    }
}
